﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using iTextSharp.text;
//using iTextSharp.text.pdf;
//using System.IO;

//namespace BenefitHelper.Tools
//{
//    public class PDFHelper
//    {
//        Document document = null;
//        Font documentFont = null;
//        Font TitleFont = null;
//        Font smallTitleFont = null;

//        List<BenefitHelper.Sys.Groups> groups = null;
//        List<KeyValuePair<int, double>> groupMoney = null;
//        List<KeyValuePair<int, double>> groupMoney2 = null;
//        List<BenefitHelper.View.OperatorDayPosition> operatordaypositions = null;
//        List<BenefitHelper.Sys.DayGroupOperators> ogos = null;
//        List<BenefitHelper.View.OperatorDayChange> operatorweeksums = null;
//        List<BenefitHelper.Data.Day.GroupDayChange> groupdaysums = null;
//        BenefitHelper.Sys.TradeHistory th = null;



//        public void Write(int tradeHistoryId, string path)
//        {

//            GetDatas(tradeHistoryId);

//            BaseFont bfHei = BaseFont.createFont(AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/") + "content/images/simfang.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);

//            documentFont = new Font(bfHei);
//            documentFont.setStyle("");
//            documentFont.Size = 9;
//            //    document.PageSize=document.PageSize.a

//            TitleFont = new Font(bfHei);
//            TitleFont.setStyle("");
//            TitleFont.Size = 30;

//            smallTitleFont = new Font(bfHei);
//            smallTitleFont.setStyle("");
//            smallTitleFont.Size = 20;

//            document = new Document(PageSize.A4);
//            string _path = path.Substring(0, path.LastIndexOf("\\"));
//            if (!System.IO.Directory.Exists(_path))
//            {
//                System.IO.Directory.CreateDirectory(_path);
//            }
//            PdfWriter.getInstance(document, new FileStream(path, FileMode.Create));

//            SetYeMeiYeJiao(documentFont);
//            SetPower();


//            document.Open();

//            ////A4纸的图片应该宽度为523(770)像素
//            //Jpeg img = new Jpeg(AppDomain.CurrentDomain.BaseDirectory + "/content/images/ad1.jpg");
//            //document.Add(img);

//            //Paragraph p0 = new Paragraph("\n", documentFont);

//            //p0.Alignment = Alignment.Center;
//            //document.Add(p0);

//            Paragraph p_ = new Paragraph("\n\n\n\n\n\n\n", TitleFont);

//            p_.Alignment = Alignment.Center;
//            document.Add(p_);

//            Paragraph p1 = new Paragraph("交易数据日报", TitleFont);

//            p1.Alignment = Alignment.Center;
//            document.Add(p1);

//            Paragraph p2 = new Paragraph(th.YPdate + "年" + th.MPdate + "月" + th.DPdate + "日", smallTitleFont);
//            p2.Alignment = Alignment.Center;
//            document.Add(p2);

//            document.newPage();

//            ShouRuFenXi();
//            XiaoZuShouRuFenXi();
//            AddGroupPie();
//            AddChiCangMingXi();
//            document.Close();
//        }

//        public void GetDatas(int tradeHistoryId)
//        {
//            DB.DBManager db = new DB.DBManager();
//            th = new BenefitHelper.Sys.TradeHistory();
//            th = th.GetModel(tradeHistoryId, db);
//            groups = new BenefitHelper.Sys.Groups().GetGroups(db);
//            groupMoney = new List<KeyValuePair<int, double>>();
//            groupMoney2 = new List<KeyValuePair<int, double>>();
//            operatordaypositions = new List<BenefitHelper.View.OperatorDayPosition>();
//            ogos = new BenefitHelper.Sys.DayGroupOperators().GetGroupOperators(th.GetPdateFromTradeHistoryId(th.Id, db), db);
//            operatorweeksums = new List<BenefitHelper.View.OperatorDayChange>();
//            groupdaysums = new List<BenefitHelper.Data.Day.GroupDayChange>();







//            foreach (BenefitHelper.Sys.Groups group in groups)
//            {
//                BenefitHelper.Data.Day.GroupDayChange groupweeksum = new BenefitHelper.Data.Day.GroupDayChange().GetGroupDayChange(group.Id, tradeHistoryId, db);
//                groupdaysums.Add(groupweeksum);
//            }



//            //ViewBag.queryday = th.YPdate + "年" + th.MPdate + "月" + th.DPdate + "日";

//            foreach (BenefitHelper.Sys.Groups group in groups)
//            {
//                List<BenefitHelper.Sys.Operator> operators = new BenefitHelper.Sys.DayGroupOperators().GetGroupOperators(group.Id, th.GetPdateFromTradeHistoryId(th.Id, db), db);
//                //   
//                double groupsum = 0;
//                foreach (BenefitHelper.Sys.Operator op in operators)
//                {
//                    BenefitHelper.View.OperatorDayMoney money = new BenefitHelper.View.OperatorDayMoney().GetOperatorDayMoney(op.Id, th.Id, db);
//                    groupsum += money.PresetTlePosit;
//                }
//                KeyValuePair<int, double> kp = new KeyValuePair<int, double>(group.Id, groupsum);
//                groupMoney.Add(kp);
//            }

//            foreach (BenefitHelper.Sys.Groups group in groups)
//            {
//                List<BenefitHelper.Sys.Operator> operators = new BenefitHelper.Sys.DayGroupOperators().GetGroupOperators(group.Id, th.GetPdateFromTradeHistoryId(th.Id, db), db);
//                //   
//                double groupsum = 0;
//                foreach (BenefitHelper.Sys.Operator op in operators)
//                {
//                    BenefitHelper.View.OperatorDayMoney money = new BenefitHelper.View.OperatorDayMoney().GetOperatorDayMoney(op.Id, th.Id, db);
//                    groupsum += money.SettlePosit;
//                }
//                KeyValuePair<int, double> kp = new KeyValuePair<int, double>(group.Id, groupsum);
//                groupMoney2.Add(kp);
//            }
//            foreach (BenefitHelper.Sys.Groups group in groups)
//            {
//                List<BenefitHelper.Sys.Operator> operators = new BenefitHelper.Sys.DayGroupOperators().GetGroupOperators(group.Id, th.GetPdateFromTradeHistoryId(th.Id, db), db);
//                foreach (BenefitHelper.Sys.Operator op in operators)
//                {
//                    List<BenefitHelper.View.OperatorDayPosition> money = new BenefitHelper.View.OperatorDayPosition().GetAllAccountDayPositionDelivery(th.Id, op.Id, db);
//                    foreach (BenefitHelper.View.OperatorDayPosition m in money)
//                    {
//                        m.Investorid = group.Id.ToString();
//                        operatordaypositions.Add(m);
//                    }
//                }
//            }
//            foreach (BenefitHelper.Sys.Groups group in groups)
//            {
//                List<BenefitHelper.Sys.Operator> operators = new BenefitHelper.Sys.DayGroupOperators().GetGroupOperators(group.Id, th.GetPdateFromTradeHistoryId(th.Id, db), db);
//                foreach (BenefitHelper.Sys.Operator op in operators)
//                {
//                    BenefitHelper.View.OperatorDayChange sum = new BenefitHelper.View.OperatorDayChange().GetOperatorDayChange(op.Id, tradeHistoryId, db);
//                    operatorweeksums.Add(sum);
//                }
//            }
//            //  ViewBag.billpic = BenefitHelper.Tools.ChartAtManager.GroupBillPic(th.Id, db);
//        }

//        /// <summary>
//        /// 交易员收入分析
//        /// </summary>
//        /// <param name="accountid"></param>
//        /// <param name="pdate"></param>
//        /// <param name="font"></param>
//        /// <returns></returns>
//        private void ShouRuFenXi()
//        {
//            Paragraph p1 = new Paragraph("一、交易员收入分析", smallTitleFont);
//            p1.Alignment = Alignment.Left;
//            document.Add(p1);
//            double value2 = 0f;
//            double value3 = 0f;
//            double value4 = 0f;
//            double value5 = 0f;



//            foreach (BenefitHelper.Data.Day.GroupDayChange group in groupdaysums)
//            {
//                Paragraph p = new Paragraph(group.Group.GroupName, smallTitleFont);
//                p.Alignment = Alignment.Left;
//                document.Add(p);
//                Table aTable = new Table(4, 4);
//                aTable.WidthPercentage = 100;
//                aTable.Padding = 2;
//                Cell c = new Cell(new Paragraph("总盈利", documentFont));
//                c.HorizontalAlignment = Alignment.Center;
//                c.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                aTable.addCell(c);
//                c = new Cell(new Paragraph("收益率", documentFont));
//                c.HorizontalAlignment = Alignment.Center;
//                c.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                aTable.addCell(c);
//                c = new Cell(new Paragraph("投资本金", documentFont));
//                c.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c.HorizontalAlignment = Alignment.Center;
//                aTable.addCell(c);
//                c = new Cell(new Paragraph("期末结存", documentFont));
//                c.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c.HorizontalAlignment = Alignment.Center;
//                aTable.addCell(c);
//                Cell cell = new Cell(new Paragraph(string.Format("{0:N2}", group.DayCount), documentFont));
//                cell.HorizontalAlignment = Alignment.Right;
//                aTable.addCell(cell);
//                value2 += group.DayCount;
//                cell = new Cell(new Paragraph(group.Yield.ToString(), documentFont));
//                cell.HorizontalAlignment = Alignment.Right;
//                aTable.addCell(cell);
//                value3 += group.Yield;
//                foreach (KeyValuePair<int, double> kvp in groupMoney)
//                {
//                    if (kvp.Key == group.GroupId)
//                    {
//                        cell = new Cell(new Paragraph(string.Format("{0:N2}", kvp.Value), documentFont));
//                        cell.HorizontalAlignment = Alignment.Right;
//                        aTable.addCell(cell);
//                        value4 += kvp.Value;
//                        break;
//                    }
//                }

//                foreach (KeyValuePair<int, double> kvp in groupMoney2)
//                {
//                    if (kvp.Key == group.GroupId)
//                    {
//                        cell = new Cell(new Paragraph(string.Format("{0:N2}", kvp.Value), documentFont));
//                        cell.HorizontalAlignment = Alignment.Right;
//                        aTable.addCell(cell);
//                        value5 += kvp.Value;
//                        break;
//                    }
//                }
//                string unames = "";
//                cell = new Cell(new Paragraph("盈利(由大到小)", documentFont));
//                cell.HorizontalAlignment = Alignment.Center;
//                aTable.addCell(cell);
//                foreach (BenefitHelper.Sys.DayGroupOperators dgo in ogos)
//                {
//                    if (dgo.GroupId == group.GroupId)
//                    {
//                        foreach (BenefitHelper.View.OperatorDayChange sum in operatorweeksums)
//                        {
//                            if (sum.OperatorId == dgo.OperatorId && sum.DayCount > 0)
//                            {
//                                unames += sum.Operator.UName + "；";
//                            }
//                        }
//                    }
//                }
//                cell = new Cell(new Paragraph(unames, documentFont));
//                cell.HorizontalAlignment = Alignment.Left;
//                cell.Colspan = 3;
//                aTable.addCell(cell);

//                unames = "";
//                cell = new Cell(new Paragraph("亏损(由大到小)", documentFont));
//                cell.HorizontalAlignment = Alignment.Center;
//                aTable.addCell(cell);
//                foreach (BenefitHelper.Sys.DayGroupOperators dgo in ogos)
//                {
//                    if (dgo.GroupId == group.GroupId)
//                    {
//                        foreach (BenefitHelper.View.OperatorDayChange sum in operatorweeksums)
//                        {
//                            if (sum.OperatorId == dgo.OperatorId && sum.DayCount <= 0)
//                            {
//                                unames += sum.Operator.UName + "；";
//                            }
//                        }
//                    }
//                }
//                cell = new Cell(new Paragraph(unames, documentFont));
//                cell.HorizontalAlignment = Alignment.Left;
//                cell.Colspan = 3;
//                aTable.addCell(cell);

//                document.Add(aTable);
//            }

//            p1 = new Paragraph("公司小计", smallTitleFont);
//            p1.Alignment = Alignment.Left;
//            document.Add(p1);
//            Table aTable1 = new Table(4, 2);
//            aTable1.WidthPercentage = 100;
//            aTable1.Padding = 2;
//            Cell c1 = new Cell(new Paragraph("总盈利", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable1.addCell(c1);
//            c1 = new Cell(new Paragraph("收益率", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable1.addCell(c1);
//            c1 = new Cell(new Paragraph("投资本金", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable1.addCell(c1);
//            c1 = new Cell(new Paragraph("期末结存", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable1.addCell(c1);
//            c1 = new Cell(new Paragraph(string.Format("{0:N2}", value2), documentFont));
//            c1.HorizontalAlignment = Alignment.Right;
//            aTable1.addCell(c1);
//            c1 = new Cell(new Paragraph(value3.ToString(), documentFont));
//            c1.HorizontalAlignment = Alignment.Right;
//            aTable1.addCell(c1);
//            c1 = new Cell(new Paragraph(string.Format("{0:N2}", value4), documentFont));
//            c1.HorizontalAlignment = Alignment.Right;
//            aTable1.addCell(c1);
//            c1 = new Cell(new Paragraph(string.Format("{0:N2}", value5), documentFont));
//            c1.HorizontalAlignment = Alignment.Right;
//            aTable1.addCell(c1);
//            document.Add(aTable1);
//        }

//        public void AddGroupPie()
//        {
//            string pdate = th.YPdate + (th.MPdate > 9 ? "" + th.MPdate : "0" + th.MPdate) + "" + (th.DPdate > 9 ? "" + th.DPdate : "0" + th.DPdate);
//            string path = AppDomain.CurrentDomain.BaseDirectory + @"File\SummaryDayIncome\" + pdate + "_nail.gif";
//            if (System.IO.File.Exists(path))
//            {
//                Jpeg img = new Jpeg(path);
//                document.Add(img);
//            }
//        }

//        public void AddChiCangMingXi()
//        {

//            Paragraph p1 = new Paragraph("三、持仓明细", smallTitleFont);
//            p1.Alignment = Alignment.Left;
//            document.Add(p1);

//            foreach (BenefitHelper.Sys.Groups group in groups)
//            {

//                Table aTable1 = new Table(7, groups.Count + 1);
//                aTable1.WidthPercentage = 100;
//                aTable1.Padding = 2;
//                int billcount = 0;
//                double fudongyingki = 0f;
//                double margin = 0f;

//                Paragraph p = new Paragraph(group.GroupName, smallTitleFont);
//                p.Alignment = Alignment.Left;
//                document.Add(p);


//                Cell c1 = new Cell(new Paragraph("时间", documentFont));
//                c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c1.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c1);
//                c1 = new Cell(new Paragraph("价格", documentFont));
//                c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c1.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c1);
//                c1 = new Cell(new Paragraph("合约", documentFont));
//                c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c1.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c1);
//                c1 = new Cell(new Paragraph("买/卖", documentFont));
//                c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c1.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c1);
//                c1 = new Cell(new Paragraph("手数", documentFont));
//                c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c1.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c1);
//                c1 = new Cell(new Paragraph("浮动盈亏", documentFont));
//                c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c1.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c1);
//                c1 = new Cell(new Paragraph("占用保证金", documentFont));
//                c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//                c1.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c1);

//                foreach (BenefitHelper.View.OperatorDayPosition accountdayposition in operatordaypositions)
//                {
//                    if (accountdayposition.Investorid.Equals(group.Id.ToString()))
//                    {



//                        if (accountdayposition.OpenTime.ToString().Length == 5)
//                        {
//                            c1 = new Cell(new Paragraph(accountdayposition.OpenTime.ToString().Substring(0, 1) + ":" + accountdayposition.OpenTime.ToString().Substring(1, 2) + ":" + accountdayposition.OpenTime.ToString().Substring(3), documentFont));
//                            c1.HorizontalAlignment = Alignment.Center;
//                            aTable1.addCell(c1);
//                        }
//                        else
//                        {
//                            c1 = new Cell(new Paragraph(accountdayposition.OpenTime.ToString().Substring(0, 2) + ":" + accountdayposition.OpenTime.ToString().Substring(2, 2) + ":" + accountdayposition.OpenTime.ToString().Substring(4), documentFont));
//                            c1.HorizontalAlignment = Alignment.Center;
//                            aTable1.addCell(c1);
//                        }



//                        c1 = new Cell(new Paragraph(string.Format("{0:N2}", accountdayposition.OpenPrice), documentFont));
//                        c1.HorizontalAlignment = Alignment.Right;
//                        aTable1.addCell(c1);

//                        c1 = new Cell(new Paragraph(accountdayposition.InstrumentId, documentFont));
//                        c1.HorizontalAlignment = Alignment.Center;
//                        aTable1.addCell(c1);


//                        if (accountdayposition.Direction.Equals("0"))
//                        {
//                            c1 = new Cell(new Paragraph("买", documentFont));
//                            c1.HorizontalAlignment = Alignment.Center;
//                            aTable1.addCell(c1);
//                        }
//                        else
//                        {
//                            c1 = new Cell(new Paragraph("卖", documentFont));
//                            c1.HorizontalAlignment = Alignment.Center;
//                            aTable1.addCell(c1);
//                        }
//                        c1 = new Cell(new Paragraph(accountdayposition.Volume.ToString(), documentFont));
//                        c1.HorizontalAlignment = Alignment.Right;
//                        aTable1.addCell(c1);
//                        billcount += accountdayposition.Volume;

//                        c1 = new Cell(new Paragraph(string.Format("{0:N2}", accountdayposition.PositionProfit), documentFont));
//                        c1.HorizontalAlignment = Alignment.Right;
//                        aTable1.addCell(c1);

//                        fudongyingki += accountdayposition.PositionProfit;

//                        c1 = new Cell(new Paragraph(string.Format("{0:N2}", accountdayposition.Margin), documentFont));
//                        c1.HorizontalAlignment = Alignment.Right;
//                        aTable1.addCell(c1);
//                        margin += accountdayposition.Margin;
//                    }
//                }
//                Cell c = new Cell(new Paragraph("合计", documentFont));
//                c.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c);
//                c = new Cell(new Paragraph("", documentFont));
//                c.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c);
//                c = new Cell(new Paragraph("", documentFont));
//                c.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c);
//                c = new Cell(new Paragraph("", documentFont));
//                c.HorizontalAlignment = Alignment.Center;
//                aTable1.addCell(c);
//                c = new Cell(new Paragraph(billcount.ToString(), documentFont));
//                c.HorizontalAlignment = Alignment.Right;
//                aTable1.addCell(c);
//                c = new Cell(new Paragraph(string.Format("{0:N2}", fudongyingki), documentFont));
//                c.HorizontalAlignment = Alignment.Right;
//                aTable1.addCell(c);
//                c = new Cell(new Paragraph(string.Format("{0:N2}", margin), documentFont));
//                c.HorizontalAlignment = Alignment.Right;
//                aTable1.addCell(c);
//                document.Add(aTable1);
//            }

//        }


//        /// <summary>
//        /// 小组收入分析
//        /// </summary>
//        public void XiaoZuShouRuFenXi()
//        {
//            Paragraph p1 = new Paragraph("二、小组收入分析", smallTitleFont);
//            p1.Alignment = Alignment.Left;
//            document.Add(p1);

//            var query = groupdaysums.Count() + 1;
//            Table aTable = new Table(5, query);
//            aTable.WidthPercentage = 100;
//            aTable.Padding = 2;
//            Cell c1 = new Cell(new Paragraph("姓名", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable.addCell(c1);
//            c1 = new Cell(new Paragraph("笔数", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable.addCell(c1);
//            c1 = new Cell(new Paragraph("手续费", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable.addCell(c1);
//            c1 = new Cell(new Paragraph("平仓盈亏", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable.addCell(c1);
//            c1 = new Cell(new Paragraph("净盈利", documentFont));
//            c1.BackgroundColor = new iTextSharp.text.Color(238, 242, 248);
//            c1.HorizontalAlignment = Alignment.Center;
//            aTable.addCell(c1);
//            double allbillcount = 0f;
//            double allfree = 0f;
//            double allprofit = 0f;
//            double alldaycount = 0f;

//            foreach (BenefitHelper.Data.Day.GroupDayChange group in groupdaysums)
//            {
//                Cell cell = new Cell(new Paragraph(group.Group.GroupName, documentFont));
//                cell.HorizontalAlignment = Alignment.Center;
//                aTable.addCell(cell);
//                cell = new Cell(new Paragraph(group.BillCount.ToString(), documentFont));
//                cell.HorizontalAlignment = Alignment.Right;
//                aTable.addCell(cell);
//                cell = new Cell(new Paragraph(string.Format("{0:N2}", group.Free), documentFont));
//                cell.HorizontalAlignment = Alignment.Right;
//                aTable.addCell(cell);
//                cell = new Cell(new Paragraph(string.Format("{0:N2}", group.Profit), documentFont));
//                cell.HorizontalAlignment = Alignment.Right;
//                aTable.addCell(cell);
//                cell = new Cell(new Paragraph(string.Format("{0:N2}", group.DayCount), documentFont));
//                cell.HorizontalAlignment = Alignment.Right;
//                aTable.addCell(cell);

//                allbillcount += group.BillCount;
//                allfree += group.Free;
//                allprofit += group.Profit;
//                alldaycount += group.DayCount;

//            }
//            c1 = new Cell(new Paragraph("合计", documentFont));

//            c1.HorizontalAlignment = Alignment.Center;
//            aTable.addCell(c1);
//            Cell cell1 = new Cell(new Paragraph(allbillcount.ToString(), documentFont));
//            cell1.HorizontalAlignment = Alignment.Right;
//            aTable.addCell(cell1);
//            cell1 = new Cell(new Paragraph(string.Format("{0:N2}", allfree), documentFont));
//            cell1.HorizontalAlignment = Alignment.Right;
//            aTable.addCell(cell1);
//            cell1 = new Cell(new Paragraph(string.Format("{0:N2}", allprofit), documentFont));
//            cell1.HorizontalAlignment = Alignment.Right;
//            aTable.addCell(cell1);
//            cell1 = new Cell(new Paragraph(string.Format("{0:N2}", alldaycount), documentFont));
//            cell1.HorizontalAlignment = Alignment.Right;
//            aTable.addCell(cell1);

//            document.Add(aTable);
//        }

//        /// <summary>
//        /// 设置页眉页脚
//        /// </summary>
//        /// <param name="font"></param>
//        public void SetYeMeiYeJiao(Font font)
//        {
//            HeaderFooter header = new HeaderFooter(new Phrase("上海融航信息技术有限公司", font), false);
//            header.Border = Rectangle.BOTTOM;
//            header.BorderWidth = 0.5f;

//            header.BorderColor = new Color(56, 56, 56);


//            header.Alignment = Alignment.Right;
//            document.Header = header;
//            Phrase pbefor = new Phrase("交易员分析系统日报表", font);

//            HeaderFooter footer = new HeaderFooter(pbefor, true);
//            footer.Border = Rectangle.TOP;
//            footer.Alignment = Alignment.Right;
//            document.Footer = footer;

//            ////水印图片
//            //Image img = Image.getInstance(AppDomain.CurrentDomain.BaseDirectory + "images/logo.png");
//            //img.GrayFill = 0.3f;
//            //Watermark watermark = new Watermark(img, 200, 420);
//            //document.Add(watermark);

//        }
//        /// <summary>
//        /// 设置版权信息
//        /// </summary>
//        public void SetPower()
//        {
//            document.addTitle("交易员分析系统日报表");
//            document.addSubject("交易员分析系统日报表");
//            document.addCreator("上海融航信息技术有限公司");
//            document.addAuthor("上海融航信息技术有限公司");
//        }
//    }
//    public class Alignment
//    {
//        public static int Left = 0;
//        public static int Center = 1;
//        public static int Right = 2;
//    }
//}
